package com.platform;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.transaction.TransactionConfiguration;
import org.springframework.transaction.annotation.Transactional;

import com.trmp.commons.util.QueryResult;
import com.trmp.sys.codeMng.entity.CodeType;
import com.trmp.sys.orgMng.dao.OrganRepository;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath:applicationContext.xml"})
@TransactionConfiguration(transactionManager="transactionManager")
@Transactional
public class Verfiy {
	@PersistenceContext
	EntityManager em;
	
	@Autowired
	private OrganRepository customDao;
	
	@Test
	public void testGetScrollData(){
		
		Pageable pageable = new PageRequest(0, 10);
		CodeType codeType = new CodeType();
		codeType.setCodeTypeID(23);
		Object[] params = new Object[]{codeType};
		
		
		String sql = "select o,a,c from OrganInfo o, AreaInfo a,CodeDesc c where o.areaId=a.areaId and o.organPro=c.codeNum and c.codeType=? ";
		
		QueryResult qr = customDao.getScrollDataByJpql(sql,params,"o.organId",pageable);
 
		List list = qr.getResultList();
		
	}
}
